<script>
function marks(id){
	var answer = confirm("Bạn có chắc chắn muốn xóa không?")
    if (answer){
        window.location = "<?php echo $this->baseUrl(); ?>/administrator/news/delete/id/"+id;
    }
    
    return false;
    
}
</script>
<style>
#msg_alert{
	border: solid 2px black;
	margin-left: 30px;
	width: 95%;
	height: 25px;
	text-align:justify;
	text-transform:uppercase;
	font-weight: bold;
	padding: 2px;
	line-height: 25px;
	background: rgb(20, 248, 221);
}
</style>
<?php if (isset($_SESSION['msg_alert'])):?>
<div id="msg_alert" style="">
	<?php echo $_SESSION['msg_alert']; $_SESSION['msg_alert'] = null;?>
</div>
<?php endif;?>
<article class="module width_full">
	
    <header>
      <h3 class="tabs_involved">Quản lý tin tức</h3>
      
<div class="functionBtnEvent">
        <ul>
        	<!-- <li><a href="<?php echo WEB_PATH;?>/administrator/news/getrssnews">Lấy tin RSS tự động</a></li> -->
        	<li><a href="<?php echo WEB_PATH;?>/administrator/news/getrssnewsv2">Lấy tin RSS tự động v2 (beta)</a></li>
        	<li><a href="<?php echo WEB_PATH;?>/administrator/news/getcrawlersitecontentv2">Tự động get tin từ 1 số nguồn v2 (beta)</a></li>
        	<!-- <li><a href="<?php echo WEB_PATH;?>/administrator/news/getcrawlersitecontent">Tự động get tin từ 1 số nguồn (beta)</a></li> -->
          	<li><a href="<?php echo WEB_PATH;?>/administrator/news/add">Thêm mới</a></li>
        </ul>
</div>
    </header>
    <div class="module_content">
        <div class="search">
            <form method="get">
                <input  type="text" placeholder="Nhập từ khóa" name="key"/>
                <input  type="submit" value="Tìm kiếm"/>
            </form>
        </div>
        <table cellspacing="0" class="tablesorter tablesorterBorder">
        <thead>
        <tr>
                <th width="15">STT</th>
                <th width="300">Tiêu đề</th>
                <th width="80">Ảnh</th>
                <th>Slide</th>	
                <th>Ngày đăng</th>
                <th><a href="<?php echo WEB_PATH;?>/administrator/news/index/order/view/type/<?php echo $this->order_type == "asc" ? "desc" : "asc";?>">View</a></th>
                <th><a href="<?php echo WEB_PATH;?>/administrator/news/index/order/share_wish/type/<?php echo $this->order_type == "asc" ? "desc" : "asc";?>">Share</a></th>
                <th></th>
        </tr>
        </thead>
        <?php foreach($this->data as $key=>$value):
        $class = null;
            if ($key % 2 == 0) {
                $class = ' class="altrow"';
            }
        ?> 
       <tr>
                <td><?php echo $key+1;?></td>
                <td><?php echo $value['title_vn'];?></td>
                <td><?php echo $value['pictrue'] == NULL ? "<img src='".WEB_PATH."/public/img/default-album-no-image.png'  width = '80' height = '40'/>" : "<img src='".WEB_PATH."/public/uploads/news/{$value['pictrue']}' width = '80' height = '40'/> ";?></td>
                <td><?php echo $value['slide'] == 1 ? "Mở" : "Tắt";?></td>
                <td><?php echo $value['created'];?></td>
                <td align="center"><?php echo $value['view'];?></td>
                <td align="center"><?php echo $value['share_wish'];?></td>
                <td><a href="<?php echo WEB_PATH;?>/administrator/news/edit/id/<?php echo $value['id_news'];?>">Sửa</a> | <a onclick="marks(<?php echo $value['id_news'];?>)">Xóa</a></td>
                
        </tr>
        <?php endforeach; ?>
    
        </table>
    </div>
	
 
	<div class="paging">
	<?php echo $this->paginationControl($this->data, 'Sliding', 'pagination.phtml'); ?>
	</div>
</article>